package com.sk.bilibili.adapter.simple.bottomDialog;

import android.content.Context;

import com.sk.bilibili.adapter.simple.BaseAdapter;
import com.sk.bilibili.bean.Favorites;
import com.sk.bilibili.callBack.FavoritesClickCallBack;
import com.sk.bilibili.databinding.BottomDialogCollectItemBinding;
import com.sk.bilibili.utils.StringUtils;

public class CollectAdapter extends BaseAdapter<BottomDialogCollectItemBinding, Favorites> {

    private FavoritesClickCallBack favoritesClickCallBack;

    public CollectAdapter(Context context,FavoritesClickCallBack favoritesClickCallBack) {
        super(context);
        this.favoritesClickCallBack=favoritesClickCallBack;
    }

    @Override
    protected void bindView(BottomDialogCollectItemBinding bind, int position) {
        Favorites favorites = list.get(position);
        bind.tvName.setText(favorites.getTitle());
        bind.tvInfo.setText(StringUtils.getFavoritesState(favorites.getCount(),favorites.getOpened()));
        bind.getRoot().setOnClickListener(v-> favoritesClickCallBack.onFavoritesClick(favorites.getId()));
    }

}